<template>
	<ls-page title=''>
		<view class="promoteCode-container">
			<view class="promoteCode-container-h2">
				{{currentTableName ? currentTableName: ''}}
			</view>
			<view class="promoteCode-container-main">
				<view class="main-center" :class="themetype == '001' ? 'qunqing' :''">
					<view class="main-img" :class="themetype == '001' ? 'qunqing' :''" v-if="qrcodeUrl" catchtap="previewImage">
						<image class="main-center-img" :class="themetype == '001' ? 'qunqing' :''" :src="qrcodeUrl" mode="aspectFill" :show-menu-by-longpress="true"
							bindlongpress="longPressHandler"></image>
					</view>
					<view class="main-img" :class="themetype == '001' ? 'qunqing' :''" v-else catchtap="previewImage" style="display: flex;flex-direction: column;">
						<image v-if="themetype == '001'" style="width: 280rpx;height: 280rpx;" class="main-center-img"
							src="https://oss.jtmckj.com/Roomdev/defut-img.png" mode="aspectFill"
							:show-menu-by-longpress="true" bindlongpress="longPressHandler"></image>
						<image v-else style="width: 280rpx;height: 280rpx;" class="main-center-img"
							src="https://oss.jtmckj.com/Roomdev/defut-img.png" mode="aspectFill"
							:show-menu-by-longpress="true" bindlongpress="longPressHandler"></image>
					</view>
					<view class="main-center-btn" data-opentype="redirectTo" @click="goOrder" v-if="shopInfo.isJumpAddFriend" data-url="/pages/home/order/order">
						跳过添加好友直接点单
					</view>

				</view>
				<view class="main-footer">
					癸卯兔科技发展集团 极兔妙创网络科技 技术支持
				</view>
			</view>
			<!-- <image class="promoteCode-img" src="https://oss.jtmckj.com/wmp/images/account/i_cover.png" mode="aspectFill" />   -->
		</view>
	</ls-page>
</template>

<script setup>
	import { ref } from 'vue';
	import { onLoad, onShow } from '@dcloudio/uni-app';
	import { HFiveMemberAppObjProcess } from '@/api/public.js'
	const shopInfo = uni.getStorageSync('shopInfo')
	console.log(shopInfo, 'shopInfo')
	const currentTableName = ref('')
	const qrcodeUrl = ref('')
	const themetype = uni.getStorageSync('themeInfo')?.type
	onLoad((options) => {
		currentTableName.value = uni.getStorageSync('shopInfo')?.orgName
	});

	onShow(() => { 
		uni.setStorageSync('showAdv',true)
		// // 房台信息
		// const scanData = app.global.scanData
		// HFiveMemberAppObjProcess({
		// 	"functionName": "GetRoomInfo_Mini",
		// 	"contentData": {
		// 		roomCode: scanData.code
		// 	}
		// }).then(res => {
		// 	this.data.consumeNum = res.name 
		// })
		let res = uni.getStorageSync('tableInfo')
		if (res.name) {
			let sendModal = { functionName: "WorkQrCode_H5", contentData: { roomNum: res.name } }
			HFiveMemberAppObjProcess(sendModal).then(res => {
				console.log('res：', res)
				qrcodeUrl.value = res.data
			})
		}

	});

	const goOrder = () => {
		uni.reLaunch({
			url: '/pages/home/index'
		})
		
	}
</script>

<style lang="less" scoped>
	::v-deep .u-navbar--fixed{
		display: none;
	}
	.promoteCode-container {
		overflow: scroll;
		width: 100%;
		height: 100%;
		box-sizing: border-box;
		padding: 36rpx 0rpx 0;
		background-color: var(--one--back-color);
		// background-image:url('https://oss.jtmckj.com/wmp/images/account/i_back_top.png');
		background-repeat: no-repeat;
		background-size: 100% 540rpx;
		background-position: center top;
		padding-bottom: 40rpx;
		position: relative;

		.promoteCode-container-h2 {
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 40rpx;
			color: var(--one--self--color);
			line-height: 40rpx;
			padding: 0 0 40rpx 40rpx;
		}

		.promoteCode-container-main {
			// background-image:url('https://oss.jtmckj.com/wmp/images/account/i_cover.png');
			background-repeat: no-repeat;
			background-size: 100% 432rpx;
			background-position: center bottom;
			.main-center {
				// width: 100%;
				height: 860rpx;
				background-image: url('https://oss.jtmckj.com/wmp/qnjg/pre/i_btn.png');
				background-repeat: no-repeat;
				background-size: 670rpx 1160rpx;
				background-position: center top;
				position: relative;
				padding-top: 326rpx;
				&.qunqing{
					background-image: url('https://jtmc.oss-cn-hangzhou.aliyuncs.com/wmp/qnjg/share/i_add.png');
				}
				.main-img {
					display: flex;
					align-items: center;
					justify-content: center;
					
					&.qunqing{
						padding-top: 245rpx;
					}
					.main-center-img {
						// position: absolute;
						width: 480rpx;
						height: 480rpx;
						border-radius: 24rpx;
						&.qunqing{
							width: 280rpx;
							height: 280rpx;
						}
						// left: 50%;
						// margin: 0 auto;

						// margin: 326rpx 0 0 135rpx;
					}
				}

				.main-center-btn {
					position: absolute;
					bottom: 50rpx;
					left: 135rpx;
					width: 480rpx;
					background: var(--dt-backcolorPink);
					border-radius: 8px;
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: var(--maincolor);
					line-height: 28rpx;
					text-align: center;
					padding: 27rpx 0;

					&::after {
						content: '';
						position: absolute;
						top: 30rpx;
						right: 80rpx;
						width: 13rpx;
						height: 23rpx;
						background-image: url('https://oss.jtmckj.com/wmp/qnjg/order/i_icon_tra-ora.png');
						background-size: 100% auto;
						background-position: right center;
						background-repeat: no-repeat;
					}
				}
			}

			.main-footer {
				padding: 30rpx 0 24rpx;
				text-align: center;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: var(--third--self--color);
				line-height: 24rpx;
			}
		}

		// .promoteCode-img{
		//     position: absolute;
		//     width: 100%;
		//     height: 432rpx;
		//     bottom: 0rpx;
		// }
	}
</style>